package cn.javasm.demo;

import cn.javasm.entity.User;
import cn.javasm.enums.PrivEnum;
import cn.javasm.web.UserController;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.security.PublicKey;

/**
 * @version: 0.1
 */
public class TestDemo {
    // cust  user  admin
    public static PrivEnum role = PrivEnum.USER;
    public static void main(String[] args) {

        // 加载核心配置文件
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        // 获取对象
        UserController userController = applicationContext.getBean(UserController.class);
        User user = new User(2, "猪八戒", "高老庄");
        userController.registUser(user);
        userController.updateUser(user);
        System.out.println(userController.queryUserById(1));
        userController.deleteUserById(2);
    }
}
